#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    getline(cin, s);
    int ans = 0;
    auto end = s.end() - 1;
    auto begin = s.begin();
    while (begin != end && *end == ' ')
    {
        end--;
    }
    while (*end != ' ')
    {
        if (begin == end)
        {
            ans++;
            break;
        }
        end--;
        ans++;
    }
    cout << ans;
    return 0;
}